<style>
.progress-relative {
    position: relative;
    height: 30px;
    line-height: 22px;
    background-color: #e6e6e6;
	overflow:visible;
	padding:4px;
	max-width:750px;
}
.progress-relative .progress-cover {
    position: absolute;
    text-align: center;
    width: 100%;
    font-size: 75%;
    color: #FFF;
    text-shadow: 1px 1px 1px #000;
    font-weight: 700;
}

</style>
<div class="main-header" style="line-height:34px;padding:3px 15px;">
	<b id="title_orgname">$org['orgname'] </b>
	<!--{if $_G['adminid']==1}-->
	<a href="{ADMINSCRIPT}?mod=orguser&op=export&orgid=$orgid" class="btn btn-link pull-right" title="{lang export_excl}" target="_blank">{lang export_user}</a>
	<!--{/if}-->
</div>
<div class="main-body" style="padding:15px 15px 15px 22px;">
<dl>
		<dt>{lang orgname}</dt>
		<dd class="clearfix">
              <input type="text" id="orgname" data-oldname="$org[orgname]" class="form-control" value="$org[orgname]" placeholder="{lang orgname_placeholder}" onchange="set_org_orgname('$org[orgid]',this)">
        </dd>
     </dl> 
     <dl>
		<dt>Logo</dt>
		<dd class="clearfix" style="position:relative">
			
            <ul class="group-head">

                <li class="head-portrait">
					$org['avatar']
                   
                    <div class="head-checkbox  hover" >
                        <div class="checkbox-custom checkbox-primary">
                            <input type="checkbox" class="headinput-checkbox" name="arr[aid]" value="$value[aid]"
                                   checked="checked"  onchange="set_org_logo('$org[orgid]',this.value)">
                            
                        </div>
                    </div>
                </li>

                <li class="head-file">
                    <input type="file" style=" cursor: pointer;" onclick="upload_bgphoto(this,true)"> 
                    <button type="button" class="btn btn-primary" style="margin-top: 5px;cursor: pointer;">{lang change}</button>
                </li>
            </ul>
         </dd>
     </dl>
      <dl>
		<dt>{lang org_description}</dt> 
        <dd class="clearfix">                 
             <textarea class="form-control setup-textarea" name="arr[desc]" rows="1" placeholder="{lang org_description_placeholder}" onchange="set_org_desc('$org[orgid]',this.value)">$org[desc]</textarea>
           </dd>
     </dl>   
      
	<!--{if $folder_available}-->
	<dl>
		<!--原共享目录设置：diron,此处暂时用来控制应用内是否开启共享目录，如网盘群组开关不开启，表示网盘内不显示该目录-->
		<dt>{lang shared_directory_set}</dt>
		<dd class="clearfix">
			<div class="radio-custom radio-primary pull-left"><input type="radio" id="folder_available_1" name="fid" value="1" <!--{if $org[diron]>0}-->checked="checked"<!--{/if}--> onclick="folder_available(1,'$orgid');"  /><label>{lang enable}</label>
            </div>
            <div class="radio-custom radio-primary ml20 pull-left">
			<input type="radio" id="folder_available_0" name="fid"  value="0" <!--{if $org[diron]<1}-->checked="checked"<!--{/if}--> onclick="folder_available(0,'$orgid');" /><label>{lang no_enable}</label>
            </div>
        </dd>
        <dd class="clearfix">
			<!--{if $org['forgid']<1}-->
			<span class="help-inline ml20">{lang detail_org_explorerapp_enable}</span>
			<!--{else}-->
			<span class="help-inline ml20">{lang detail_org_enable}</span>
			<!--{/if}-->
		</dd>
	</dl>
	<dl id="indesk" style="display:none">
		<dt>{lang shared_directory_desktop_shortcut}:</dt>
		<dd class="clearfix">
			<div class="radio-custom radio-primary pull-left"><input type="radio" id="folder_indesk_1" onclick="folder_indesk(1,'$orgid');" name="indesk" value="1" <!--{if $org[indesk]>0}-->checked="checked"<!--{/if}--> /><label>{lang creation}</label></div>
			<div class="radio-custom radio-primary ml20 pull-left"><input type="radio" id="folder_indesk_0" onclick="folder_indesk(0,'$orgid');" name="indesk" value="0" <!--{if $org[indesk]<1}-->checked="checked"<!--{/if}--> /><label>{lang no_creation}</label></div>
			
		</dd>
        <dd class="clearfix">
       	 	<span class="help-inline ml20">{lang detail_org_creation}</span>
        </dd>
	</dl>
	<!--{/if}-->
    <!--{if $group_on}-->
<!--	<dl>
		<dt>{lang group_on_set}</dt>
		<dd class="clearfix">
			<div class="radio-custom radio-primary pull-left"><input type="radio" id="folder_syatemon_1" name="syatemon" value="1" &lt;!&ndash;{if $org[manageon]>0}&ndash;&gt;checked="checked"&lt;!&ndash;{/if}&ndash;&gt;      onclick="group_on(1,'$orgid');"  /><label>{lang enable}</label></div>
			<div class="radio-custom radio-primary ml20 pull-left"><input type="radio" id="folder_syatemon_0" name="syatemon"  value="0" &lt;!&ndash;{if $org[manageon]<1}&ndash;&gt;checked="checked"&lt;!&ndash;{/if}&ndash;&gt; onclick="group_on(0,'$orgid');" /><label>{lang no_enable}</label></div>
        </dd>
        <dd class="clearfix">
			&lt;!&ndash;{if $org['forgid']<1}&ndash;&gt;
			<span class="help-inline ml20">{lang group_org_no_enable}</span>
			&lt;!&ndash;{else}&ndash;&gt;
			<span class="help-inline ml20">{lang group_org_enable}</span>
			&lt;!&ndash;{/if}&ndash;&gt;
		</dd>
	</dl>-->
	<!--{/if}-->
     <!--{if $_G['adminid']==1 || $topmoderator}-->
    <dl>
    	<dt>{lang org_space_assign}</dt>
        <dd class="clearfix">
          <div  style="width:180px;display:inline-block">
          	<div class="input-group " >
            <input type="text" class="form-control input-sm" id="maxspacesize" style="width:146px;"  name="maxspacesize" value="$org[maxspacesize]" onchange="folder_maxspacesize(this,'$orgid')" />
            <span class="input-group-addon">M</span>
            </div> 
            
          </div> 
         <ul class="help-block" style="padding-left:10px">
        	 <li>{lang org_space_assign_tip}:<span class="text-danger">{eval echo ($allowallotspace == 0) ? lang('no_limit'):formatsize($allowallotspace);}</span></li>
        	 {lang org_space_assign_tips}
          </ul>
       </dd>
    </dl>
    <!--{/if}-->
     <dl>
    	<dt><!--{if $org[forgid]>0}-->{lang space_use_department}<!--{else}-->{lang space_use_org}<!--{/if}--></dt>
        <dd class="clearfix">
          <div class="progress progress-relative" style="margin:0">
          <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo round(100*($org[usesize]/($org[maxspacesize]?$org[maxspacesize]*1024*1024:($org[usesize]+1024*1024*1024))))}%">

            <span class="sr-only"> {eval echo formatsize($org[usesize])}/{eval if($org[maxallotspacesize] == -1) echo formatsize($org[usesize]);else echo ($org[maxallotspacesize] == 0)?lang('no_limit'):formatsize($org[maxallotspacesize])} </span>
          </div>
          <div class="progress-cover"> {eval echo formatsize($org[usesize])}/{eval  if($org[maxallotspacesize] == -1) echo formatsize($org[usesize]);else echo ($org[maxallotspacesize] == 0)?lang('no_limit'):formatsize($org[maxallotspacesize])}</div>
        </div>
         <ul class="help-block" style="padding-left:10px">
            {lang space_use_org_tips}
          </ul>
       </dd>
       </dl>
   

	<dl>
		<dt>{lang position_management}</dt>
		<dd class="clearfix jobs">
			<!--{loop $jobs $value}-->
			<div id="job_$value[jobid]" orgid="$value['orgid']" class="job-item-edit pull-left mb10">
				<button onclick="job_show_editor('$value[jobid]','$value['orgid']', this)" class="btn btn-simple job-name mr20">$value[name]</button>
				<div class="edit hide" style="min-width:250px">
					<div class="job-edit-control pull-left">
						<input type="text" class="form-control" value="$value[name]" style="width:100px" onkeyup="if(event.keyCode==13){job_save('$value[jobid]','$value['orgid']');return false;}">
					</div>
					<button onclick="job_save('$value[jobid]','$value['orgid']')" data-loading-text="{lang save}" class="btn btn-success job-save">{lang save} </button>
					<button class="btn btn-link todo-del" onclick="job_del('$value[jobid]','$value['orgid']')"> {lang delete} </button>
				</div>
			</div>
			<!--{/loop}-->
			<div class="new-job pull-left" style="padding:0 10px;">
				<a href="javascript:;" onclick="job_show_add_editor('$orgid',this)" class="btn btn-simple "> {lang add_position} </a>
				<div class="new-job-control hide" style="min-width:250px">
					<div class="pull-left">
						<input type="text" class="new-job-text form-control" style="width:100px" onkeyup="if(event.keyCode==13){job_add('$orgid');return false;}" placeholder="{lang position_name}">
					</div>
					<button class="btn btn-success" data-loading-text="{lang add}" onclick="job_add('$orgid')">{lang add} </button>
					<button class="btn btn-link job-del" onclick="job_cancel_add_editor('$orgid')"> {lang cancel} </button>
				</div>

			</div>
		</dd>

	</dl>
	
       
		
	<dl>
		<dt><!--{if $org['forgid']<1}-->{lang organization}<!--{else}-->{lang department}<!--{/if}-->{lang administrator}</dt>
		<dd class="clearfix">
			<ul id="moderators_container_$orgid" class="moderators-container list-unstyled clearfix">
				<!--{if $pmoderator}-->
				<li class="moderators-acceptor pull-left" orgid="$orgid" style="">
					<div class="avatar-cover"></div>
					<div class="user-item-avatar">
						<div class="avatar-face">
							<img src="avatar.php?uid=0&size=middle">
						</div>
					</div>
				</li>
				<!--{/if}-->
				<!--{loop $moderators $value}-->
				<li class="user-item pull-left" uid="$value[uid]">
					<!--{if $pmoderator}-->
					<div class="delete" onclick="moderator_del('$value[id]','$orgid',this);"><i style="color:#d2322d;font-size:16px" class="glyphicon glyphicon-remove-sign">&nbsp;</i></div>
					<!--{/if}-->
					<div class="avatar-cover"></div>
					<div class="user-item-avatar">
						<div class="avatar-face">
							{eval echo avatar_block($value[uid]);}
						</div>
					</div>
					<p class="text-center" style="height:20px;margin:5px 0;line-height:25px;overflow:hidden;"> $value[username]</p>
				</li>
				<!--{/loop}-->

			</ul>
		</dd>
		
		<dd class="clearfix">
			<ul class="help-block " style="line-height:2">
				{lang detail_org_administrator}
			</ul>
		</dd>
	</dl>

</div>


<script type="text/javascript">
	jQuery(document).ready(function(e) {
		jQuery('textarea').TextAreaExpander(33);
	});
    function set_submit(form) {
        jQuery.post('$_G[siteurl]'+'admin.php?mod=orguser&op=ajax&do=orginfo',jQuery(form).serialize(), function (data) {
            if (data['success']) {
				showmessage('{lang org_update_success}','success',3000,1);
				setTimeout(location.reload(),30000);
            }else if(data['error']){
				showmessage(data['error'],'danger',3000,1);
            }
        },'json');
        
        return false;
    }
	jQuery(document).on('click','.moderators-acceptor',function(){
		var ids=[];
		jQuery('.moderators-container .user-item').each(function(){
			ids.push(jQuery(this).attr('uid'));
		});
		showWindow('moderators','index.php?mod=system&op=selorguser&stype=2&multiple=1&callback=callback_moderators&token=$orgid&ids='+ids.join(','),'get',0)
		
	});
    jQuery(document).on('click','.headinput-checkbox',function(){
        if(jQuery(this).prop("checked")){
            jQuery(this).closest('.head-portrait').siblings('.head-portrait').find('.headinput-checkbox').prop('checked',false).parents('.head-checkbox').removeClass('hover');
            jQuery(this).parents('.head-portrait').find('.head-checkbox').addClass('hover');
        }else{
            jQuery(this).parents('.head-portrait').find('.head-checkbox').removeClass('hover');
        }

    });
	function upload_bgphoto(obj,fact) {
        'use strict';
        jQuery(obj).fileupload({
            url: 'admin.php?mod=orguser&op=ajax&do=upload',
            dataType: 'json',
            autoUpload: true,
            maxFileSize: 2000000,// 2 MB
            maxChunkSize: 2000000,//2M
            acceptFileTypes: new RegExp("\.([jpe?g|gif|png])$", 'i'),
            sequentialUploads: true,
            add: function (e, data) {
                data.context = jQuery('<div id="main"></div>');
                if (jQuery('#main div:first').length > 0) jQuery('#main div:first').before(data.context);
                else {
                    jQuery('#main').append(data.context);
                }
                data.process().done(function () {
                    data.submit();
                });
            },
            progress: function (e, data) {
                var index = 0; //data.index,
                var node = jQuery(data.context.children()[index]);
                var progress = parseInt(data.loaded / data.total * 100, 10);
                node.find('.progress-bar').css(
                        'width',
                        progress + '%'
                );
            },
            done: function (e, data) {

                jQuery.each(data.result.files, function (index, file) {
                    if (file.error) {
                        data.context.find('.progress').replaceWith('<span class="text-danger">' + file.error + '</span>');
                    } else {
                    	if(fact){
                    		var imgsexists = false;
                    		jQuery('.headinput-checkbox').each(function(){
                    			var oldaid = jQuery(this).val();
								if(oldaid == file.data.aid){
									jQuery(this).prop('checked',true);
									imgsexists = true;
									showmessage('{lang org_img_uploaded_tip}','success',3000,1);
									return false;
								}
							})
							if(!imgsexists){
								/*jQuery.post('admin.php?mod=orguser&op=ajax&do=getdefaultpic',{aid:file.data.aid},function(data){
									if(data['success']){
										//jQuery('.head-checkbox').removeClass('hover').find('.headinput-checkbox').prop('checked',false);*/
										var html ='<li class="head-portrait">'+'<img src="'+file.data.img+'"><div class="head-checkbox hover">'+
												'<div class="checkbox-custom checkbox-primary"> <input type="checkbox" class="headinput-checkbox" name="arr[aid]" value="'+file.data.aid+'" checked="checked" onchange="set_org_logo(\'$org[orgid]\',this.value)" />'+
												' </div> </div> ';
										jQuery('.head-portrait').replaceWith(html);
										set_org_logo('$orgid',file.data.aid);
								/*	}
								},'json')*/
							}
                    	}else{
                    		data.context.data('aid', file.data.aid).find('img').attr('src', file.data.img).end().find('.progress-container').hide();
                            var html = '<div class="col-sm-7 setting-img"><img class="img-rounded" src="'+file.data.img+'"><p class="upload-click">{lang clicktoupload}</p> <input type="file" id="exampleInputFile" onclick="upload_bgphoto(this)" name="files[]"></div>';				
							set_org_bgphoto('$org[orgid]',file.data.aid);
                            jQuery('.setting-img').replaceWith(html);

                    	}
                        
                    }
                });
            }
        })
    };
 
 
</script>